{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <form class="form-horizontal" method="post">
            <div class="col-sm-12">
                <div class="tabs-container">
                    <div class="tab-content">
                        <div id="tab-1" class="tab-pane active">
                            <div class="ibox-content">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"> 状态：</label>
                                    <div class="col-sm-9">
                                        <div class="radio i-checks">
                                            <label>
                                                <input type="radio" value="0" name="hide" {if empty($name.hide)}checked="checked"{/if} />显示
                                            </label>
                                            <label>
                                                <input type="radio" value="1" name="hide" {if isset($name.hide) and $name.hide eq 1}checked="checked"{/if} />隐藏
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">名称：</label>
                                    <div class="col-sm-9">
                                        <input name="name" type="text" class="form-control" value="{$name.name|default=""}" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">图标：</label>
                                    <div class="col-sm-9">
                                        <div class="radio i-checks choose-icon-type">
                                            <label>
                                                <input type="radio" name="icon_type" {if isset($name.icon) and in_array($name.icon, $icons)}checked{/if} value="1" /> 选择默认
                                            </label>
                                            <label>
                                                <input type="radio" name="icon_type" {if empty($name.icon) or !in_array($name.icon, $icons)}checked{/if} value="2" /> 本地上传
                                            </label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"></label>
                                    <div class="col-sm-9" id="choose_icon_type">
                                        <div class="radio i-checks choose-icon" {if empty($name.icon) or !in_array($name.icon, $icons)}style="display:none;"{/if}>
                                            {volist name="icons" id="icon"}
                                            <label>
                                                <input type="radio" name="icon_choose" {if isset($name.icon) and $name.icon eq $icon}checked{/if} value="{$icon}" /> <img src="{$icon}" width="30" height="30" />
                                            </label>
                                            {/volist}
                                        </div>
                                        <div class="input-group" {if isset($name.icon) and in_array($name.icon, $icons)}style="display:none;"{/if}>
                                            <input name="icon_upload" type="text" id="image" class="form-control" value="{$name.icon|default=""}" />
                                            <span class="input-group-btn">
                                                <button type="button" class="btn btn-primary" id="upload">上传图标</button>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">排序：</label>
                                    <div class="col-sm-9">
                                        <input name="order" type="text" class="form-control" onkeyup="this.value = this.value.replace(/[^\d]/g,'')" value="{$name.order|default="50"}" />
                                        <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 数字越小越靠前</span>
                                    </div>
                                </div>
                                <input name="id" type="hidden" value="{$name.id|default="0"}" />
                                <hr>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
{include file="public/footer" /}
{load href="__STYLE__/admin/plugins/iCheck/icheck.min.js"}
{load href="__STYLE__/admin/plugins/iCheck/custom.css"}
<script type="text/javascript">
$(document).ready(function(){
    $(".i-checks").iCheck({
        checkboxClass: "icheckbox_square-green",
        radioClass: "iradio_square-green",
    });
});
$(".choose-icon-type").on('ifClicked', function (e) {
    var type = e.target.value, node = $(this).parent().parent().next();
    if (type == 1) {
        node.find('.radio').show();
        node.find('.input-group').hide();
    }
    if (type == 2) {
        node.find('.radio').hide();
        node.find('.input-group').show();
    }
});
$("#upload").click(function(){
    layer.open({
        type: 2,
        title: '上传图标',
        shadeClose: true,
        shade: 0.2,
        area: ['70%', '60%'],
        skin:'shangchuantup',
        content: "{:url('index/upload', ['type' => 'content'])}",
        shift:-1,
        scrollbar: false,
        moveType: 1,
        moveOut: true
    });
});
</script>
{include file="public/bottom" /}